import Vue from "vue";
import VueRouter from "vue-router";
import home from '@/App.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: home,
    redirect: '/questions',
    children:[
      {
        path:'tweenmax',
        name: 'tweenmax',
        component: ()=>import('@/views/tweenmax/index.vue')
      },
      {
        path:'lodash',
        name: 'lodash',
        component: ()=>import('@/views/lodash/index.vue')
      },
      {
        path:'tree',
        name: 'tree',
        component: ()=>import('@/views/exp/tree.vue')
      },
      {
        path:'questions',
        name: 'questions',
        component: ()=>import('@/views/questions/index.vue'),
        redirect: '/questions/algorithm',
        children: [{
          path:'algorithm',
          name: 'algorithm',
          component: ()=>import('@/views/questions/algorithm/index.vue')
        },{
          path:'traversal',
          name: 'traversal',
          component: ()=>import('@/views/questions/algorithm/traversal.vue')
        }]
      },
    ]
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
